package com.hmy.finance.dal.po;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.hmy.finance.dal.po.json.*;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 设备租赁记录表
 *
 * @author songkf
 * @TableName device_rental_record
 */
@TableName(value = "device_rental_record", autoResultMap = true)
@Data
public class DeviceRentalRecordPo implements Serializable {
    @TableField(exist = false)
    private static final long serialVersionUID = 6844673644660246489L;
    /**
     * 主键标识
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 客户ID
     */
    @TableField(value = "customer_id")
    private Long customerId;

    /**
     * 客户信息
     */
    @TableField(value = "customer_extension_info", typeHandler = JacksonTypeHandler.class)
    private CustomerExtensionInfoJson customerExtensionInfo;

    /**
     * 订单ID
     */
    @TableField(value = "order_id")
    private Long orderId;

    /**
     * 订单信息
     */
    @TableField(value = "order_extension_info", typeHandler = JacksonTypeHandler.class)
    private OrderExtensionInfoJson orderExtensionInfo;

    /**
     * 日租金单价
     */
    @TableField(value = "daily_rental_price")
    private BigDecimal dailyRentalPrice;

    /**
     * 月租金单价
     */
    @TableField(value = "monthly_rental_price")
    private BigDecimal monthlyRentalPrice;

    /**
     * 是否使用月租金单价
     */
    @TableField(value = "use_monthly_rental_price")
    private Boolean useMonthlyRentalPrice = false;
    /**
     * 报停总天数
     */
    @TableField(value = "total_pause_days")
    private Double totalPauseDays = 0d;
    /**
     * 总租赁天数
     */
    @TableField("total_rental_days")
    private Double totalRentalDays = 0d;

    /**
     * 总计出租天数
     */
    @TableField("total_lease_days")
    private Double totalLeaseDays = 0d;
    /**
     * 总计剩余暂停天数
     */
    @TableField("total_remaining_pause_days")
    private Double totalRemainingPauseDays = 0d;
    /**
     * 合同ID
     */
    @TableField(value = "contract_id")
    private Long contractId;

    /**
     * 合同编号
     */
    @TableField(value = "contract_no")
    private String contractNo;


    /**
     * 合同额外信息
     */
    @TableField(value = "contract_extension_info", typeHandler = JacksonTypeHandler.class)
    private ContractExtensionInfoJson contractExtensionInfo;

    /**
     * 进场单ID
     */
    @TableField(value = "entry_form_id")
    private Long entryFormId;

    /**
     * 进场运费信息
     */
    @TableField(value = "entry_shipping_info", typeHandler = JacksonTypeHandler.class)
    private ShippingInfoJson entryShippingInfo;

    /**
     * 改装费信息
     */
    @TableField(value = "modification_fee_info", typeHandler = JacksonTypeHandler.class)
    private ModificationFeeInfoJson modificationFeeInfo;

    /**
     * 退场单ID
     */
    @TableField(value = "exit_form_id")
    private Long exitFormId;

    /**
     * 退场运费信息
     */
    @TableField(value = "exit_shipping_info", typeHandler = JacksonTypeHandler.class)
    private ShippingInfoJson exitShippingInfo;

    /**
     * 设备ID
     */
    @TableField(value = "device_id")
    private Long deviceId;

    /**
     * 设备编号
     */
    @TableField(value = "device_no")
    private String deviceNo;

    /**
     * 设备信息
     */
    @TableField(value = "device_extension_info", typeHandler = JacksonTypeHandler.class)
    private DeviceInfoJson deviceExtensionInfo;

    /**
     * 起租时间
     */
    @TableField(value = "rental_start_time")
    private LocalDateTime rentalStartTime;

    /**
     * 退租时间
     */
    @TableField(value = "rental_end_time")
    private LocalDateTime rentalEndTime;

    /**
     * 费用周期开始时间
     */
    @TableField(value = "expense_cycle_start_time")
    private LocalDateTime expenseCycleStartTime;
    /**
     * 费用周期结束时间
     */
    @TableField(value = "expense_cycle_end_time")
    private LocalDateTime expenseCycleEndTime;
    /**
     * 计费截止时间
     */
    @TableField(value = "billing_through_time")
    private LocalDateTime billingThroughTime;
    /**
     * 总租金
     */
    @TableField(value = "total_rental_amount")
    private BigDecimal totalRentalAmount = BigDecimal.ZERO;

    /**
     * 总收入(总营收)
     */
    @TableField(value = "total_revenue_amount")
    private BigDecimal totalRevenueAmount = BigDecimal.ZERO;

    /**
     * 总损益
     */
    @TableField(value = "total_profit_loss_amount")
    private BigDecimal totalProfitLossAmount = BigDecimal.ZERO;
    /**
     * 已对账金额
     */
    @TableField(value = "total_reconciled_amount")
    private BigDecimal totalReconciledAmount = BigDecimal.ZERO;

    /**
     * 总账单已对账金额
     */
    @TableField(value = "history_reconciled_amount")
    private BigDecimal historyReconciledAmount = BigDecimal.ZERO;

    /**
     * 未对账金额
     */
    @TableField(value = "total_unreconciled_amount")
    private BigDecimal totalUnreconciledAmount = BigDecimal.ZERO;

    /**
     * 上次对账时间
     */
    @TableField(value = "last_reconciliation_time")
    private LocalDateTime lastReconciliationTime;

    /**
     * 账龄信息
     */
    @TableField(value = "overdue_info_list", typeHandler = OverdueInfoJsonHandler.class)
    private List<OverdueDetailJson> overdueInfoList;

    /**
     * 冲抵标识：1-允许冲抵，2-停止冲抵
     */
    @TableField(value = "offset_flag")
    private Integer offsetFlag;
    /**
     * 流水标识：1-允许流水，2-停止流水
     */
    @TableField(value = "flow_flag")
    private Integer flowFlag;
    /**
     * 销售经理ID
     */
    @TableField(value = "sale_manager_id")
    private Long saleManagerId;

    /**
     * 销售经理姓名
     */
    @TableField(value = "sale_manager_name")
    private String saleManagerName;

    /**
     * 部门ID
     */
    @TableField(value = "sale_manager_dept_id")
    private Long saleManagerDeptId;
    @TableLogic
    private Boolean isDeleted;
}